.class public Llt/noframe/gpsfarmguide/utils/RuntimePermissions;
.super Ljava/lang/Object;
.source "RuntimePermissions.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Llt/noframe/gpsfarmguide/utils/RuntimePermissions$OnPermissionListener;
    }
.end annotation


# instance fields
.field private onPermissionListener:Llt/noframe/gpsfarmguide/utils/RuntimePermissions$OnPermissionListener;


# direct methods
.method public constructor <init>()V
    .locals 0

    .line 14
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method private sendPermissionDenied()V
    .locals 2

    .line 55
    iget-object v0, p0, Llt/noframe/gpsfarmguide/utils/RuntimePermissions;->onPermissionListener:Llt/noframe/gpsfarmguide/utils/RuntimePermissions$OnPermissionListener;

    if-eqz v0, :cond_0

    .line 56
    invoke-interface {v0}, Llt/noframe/gpsfarmguide/utils/RuntimePermissions$OnPermissionListener;->permissionDenied()V

    goto :goto_0

    :cond_0
    const-string v0, "RuntimePermissions"

    const-string v1, "sendPermissionGranted: LISTENER IS NULL"

    .line 57
    invoke-static {v0, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    :goto_0
    return-void
.end method

.method private sendPermissionGranted()V
    .locals 2

    .line 49
    iget-object v0, p0, Llt/noframe/gpsfarmguide/utils/RuntimePermissions;->onPermissionListener:Llt/noframe/gpsfarmguide/utils/RuntimePermissions$OnPermissionListener;

    if-eqz v0, :cond_0

    .line 50
    invoke-interface {v0}, Llt/noframe/gpsfarmguide/utils/RuntimePermissions$OnPermissionListener;->permissionGranted()V

    goto :goto_0

    :cond_0
    const-string v0, "RuntimePermissions"

    const-string v1, "sendPermissionGranted: LISTENER IS NULL"

    .line 51
    invoke-static {v0, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    :goto_0
    return-void
.end method


# virtual methods
.method public requestGPS(Landroid/app/Activity;Llt/noframe/gpsfarmguide/utils/RuntimePermissions$OnPermissionListener;)V
    .locals 3

    .line 61
    iput-object p2, p0, Llt/noframe/gpsfarmguide/utils/RuntimePermissions;->onPermissionListener:Llt/noframe/gpsfarmguide/utils/RuntimePermissions$OnPermissionListener;

    const-string v0, "android.permission.ACCESS_FINE_LOCATION"

    .line 62
    invoke-static {p1, v0}, Landroidx/core/content/ContextCompat;->checkSelfPermission(Landroid/content/Context;Ljava/lang/String;)I

    move-result v1

    if-eqz v1, :cond_1

    .line 66
    invoke-static {p1, v0}, Landroidx/core/app/ActivityCompat;->shouldShowRequestPermissionRationale(Landroid/app/Activity;Ljava/lang/String;)Z

    move-result p2

    const/4 v1, 0x0

    const/4 v2, 0x1

    if-eqz p2, :cond_0

    .line 67
    new-array p2, v2, [Ljava/lang/String;

    aput-object v0, p2, v1

    invoke-static {p1, p2, v2}, Landroidx/core/app/ActivityCompat;->requestPermissions(Landroid/app/Activity;[Ljava/lang/String;I)V

    goto :goto_0

    .line 72
    :cond_0
    new-array p2, v2, [Ljava/lang/String;

    aput-object v0, p2, v1

    invoke-static {p1, p2, v2}, Landroidx/core/app/ActivityCompat;->requestPermissions(Landroid/app/Activity;[Ljava/lang/String;I)V

    goto :goto_0

    .line 78
    :cond_1
    invoke-interface {p2}, Llt/noframe/gpsfarmguide/utils/RuntimePermissions$OnPermissionListener;->permissionGranted()V

    :goto_0
    return-void
.end method

.method public requestPermissionResponse(I[Ljava/lang/String;[I)V
    .locals 0

    const/4 p2, 0x1

    if-eq p1, p2, :cond_0

    return-void

    .line 34
    :cond_0
    array-length p1, p3

    if-lez p1, :cond_1

    const/4 p1, 0x0

    aget p1, p3, p1

    if-nez p1, :cond_1

    .line 37
    invoke-direct {p0}, Llt/noframe/gpsfarmguide/utils/RuntimePermissions;->sendPermissionGranted()V

    goto :goto_0

    .line 41
    :cond_1
    invoke-direct {p0}, Llt/noframe/gpsfarmguide/utils/RuntimePermissions;->sendPermissionDenied()V

    :goto_0
    return-void
.end method
